﻿<phone:PhoneApplicationPage 
    x:Class="USpell.Views.PanoramaPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:controlsPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls" 
    xmlns:UControls="clr-namespace:USpell.Controls"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">


    <phone:PhoneApplicationPage.Resources>

    	<ControlTemplate x:Key="PanoramaControlTemplate" TargetType="controls:Panorama">
    		<Grid>
    			<Grid.RowDefinitions>
    				<RowDefinition Height="auto"/>
    				<RowDefinition Height="*"/>
    			</Grid.RowDefinitions>

    			<controlsPrimitives:PanningBackgroundLayer x:Name="BackgroundLayer" Grid.RowSpan="2" HorizontalAlignment="Left">
    				<Border x:Name="background" Background="{TemplateBinding Background}" CacheMode="BitmapCache"/>
    			</controlsPrimitives:PanningBackgroundLayer>

    			<controlsPrimitives:PanningTitleLayer x:Name="TitleLayer" Grid.Row="0" HorizontalAlignment="Left"  Margin="125,10,0,9"
    				Content="{TemplateBinding Title}" ContentTemplate="{TemplateBinding TitleTemplate}" 
    				Foreground="Gainsboro" FontSize="48" CacheMode="BitmapCache" >
    				<controlsPrimitives:PanningTitleLayer.Background>
    					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    						<GradientStop Color="Black" Offset="0"/>
    						<GradientStop Color="White" Offset="1"/>
    					</LinearGradientBrush>
    				</controlsPrimitives:PanningTitleLayer.Background>
    			</controlsPrimitives:PanningTitleLayer>

    			<controlsPrimitives:PanningLayer x:Name="ItemsLayer" Grid.Row="1" HorizontalAlignment="Left">
    				<ItemsPresenter x:Name="items"/>
    			</controlsPrimitives:PanningLayer>

    		</Grid>
    	</ControlTemplate>
    	<Style x:Key="PanoramaItemStyle" TargetType="controls:PanoramaItem">
    		<Setter Property="CacheMode" Value="BitmapCache"/>
    		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    		<Setter Property="VerticalContentAlignment" Value="Stretch"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="controls:PanoramaItem">
    					<Grid Background="{TemplateBinding Background}" Margin="12,0,0,0">
    						<Grid.RowDefinitions>
    							<RowDefinition Height="auto"/>
    							<RowDefinition Height="*"/>
    						</Grid.RowDefinitions>
                            <ContentControl x:Name="header" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" HorizontalAlignment="Left" Margin="10,-2,0,26" FontSize="48" Foreground="Gainsboro">
    							<ContentControl.RenderTransform>
    								<TranslateTransform x:Name="headerTransform"/>
    							</ContentControl.RenderTransform>
    						</ContentControl>
    						<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
    					</Grid>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>

    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot">
        <controls:Panorama Title="--我拼你猜--" Template="{StaticResource PanoramaControlTemplate}" ItemContainerStyle="{StaticResource PanoramaItemStyle}">
            <controls:Panorama.Background>
                <ImageBrush ImageSource="/USpell;component/Resources/BlackGround/5.jpg"></ImageBrush>
            </controls:Panorama.Background>
            <controls:PanoramaItem Header="我要猜" Margin="0,0,-20,0" >
                <Grid>
                    <ListBox ItemsSource="{Binding MyGuesses, Mode=TwoWay}" x:Name="lb_GuessFrom" Margin="10,10,0,0" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel>
                                    <UControls:GuessItem Margin="0,10,0,10" InfoText="{Binding GuessInfo, Mode=TwoWay}" CreateTime="{Binding CreateTime, Mode=TwoWay}"></UControls:GuessItem>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PanoramaItem>

            <controls:PanoramaItem Header="我要拼" Margin="20,0,-20,0">
                <Grid>
                    <ListBox ItemsSource="{Binding MySpell, Mode=TwoWay}" x:Name="lb_GuessTo" Margin="10,10,0,0" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel>
                                    <UControls:GuessItem Margin="0,10,0,10" InfoText="{Binding GuessInfo, Mode=TwoWay}" CreateTime="{Binding CreateTime, Mode=TwoWay}"></UControls:GuessItem>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PanoramaItem>

            <controls:PanoramaItem Header="设置">
                <Grid/>
            </controls:PanoramaItem>
            
        </controls:Panorama> 
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar BackgroundColor="#00000000">
            <shell:ApplicationBarIconButton 
                    x:Name="bar_Login"
                    IconUri="/Assets/AppBar/appbar.refresh.rest.png" 
                    Text="登录"
                    IsEnabled="True"
                    Click="bar_Login_Click"/>

            <shell:ApplicationBarIconButton 
                    x:Name="bar_CreateGuess"
                    IconUri="/Assets/AppBar/appbar.add.rest.png" 
                    Text="新建"
                    IsEnabled="True"
                    Click="bar_CreateGuess_Click" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>